28 #ifndef _spoton_listener_h_ 29 #define _spoton_listener_h_ 33 #include <QSqlDatabase> 36 #if QT_VERSION >= 0x050501 && defined(SPOTON_BLUETOOTH_ENABLED) 37 #include <qbluetoothserver.h> 38 #include <qbluetoothserviceinfo.h> 39 #include <qbluetoothsocket.h> 42 #include "Common/spot-on-misc.h" 43 #include "spot-on-neighbor.h" 45 class QNetworkInterface;
56 QObject *parent):QTcpServer(parent)
65 void setMaxPendingConnections(
const int maxPendingConnections)
67 QTcpServer::setMaxPendingConnections(qMax(1, maxPendingConnections));
70 #if QT_VERSION >= 0x050000 71 void incomingConnection(qintptr socketDescriptor);
73 void incomingConnection(
int socketDescriptor);
80 #if QT_VERSION < 0x050000 81 void newConnection(
const int socketDescriptor,
82 const QHostAddress &address,
85 void newConnection(
const qintptr socketDescriptor,
86 const QHostAddress &address,
97 QObject *parent):QUdpSocket(parent)
100 m_maxPendingConnections = 5;
102 SIGNAL(readyRead(
void)),
104 SLOT(slotReadyRead(
void)));
111 bool clientExists(
const QHostAddress &address,
const quint16 port)
const 113 return m_clients.contains(QString(
"%1:%2:%3").
114 arg(address.toString()).
115 arg(address.scopeId()).
119 int maxPendingConnections(
void)
const 121 return m_maxPendingConnections;
124 void addClientAddress(
const QString &address)
126 m_clients.insert(address, 0);
129 void setMaxPendingConnections(
const int maxPendingConnections)
131 m_maxPendingConnections = qMax(1, maxPendingConnections);
135 QHash<QString, char> m_clients;
136 int m_maxPendingConnections;
140 void slotClientDestroyed(QObject *
object)
145 QString client(object->property(
"address").toString());
147 m_clients.remove(client);
150 void slotReadyRead(
void);
153 #if QT_VERSION < 0x050000 154 void newConnection(
const int socketDescriptor,
155 const QHostAddress &address,
158 void newConnection(
const qintptr socketDescriptor,
159 const QHostAddress &address,
162 void newDatagram(
const QByteArray &datagram,
163 const QHostAddress &address,
174 const QString &scopeId,
175 const int maximumClients,
177 const QString &echoMode,
178 const unsigned int keySize,
179 const QByteArray &certificate,
180 const QByteArray &privateKey,
181 const QByteArray &publicKey,
182 const bool useAccounts,
183 const qint64 maximumBufferSize,
184 const qint64 maximumContentLength,
185 const QString &transport,
186 const bool shareAddress,
187 const QString &orientation,
189 const QString &sslControlString,
191 const int passthrough,
192 const int sourceOfRandomness,
193 const QByteArray &privateApplicationCredentials,
194 const QString &socketOptions,
197 QHostAddress externalAddress(
void)
const;
198 QHostAddress localAddress(
void)
const;
199 QString orientation(
void)
const;
200 QString serverAddress(
void)
const;
201 QString transport(
void)
const;
202 bool isListening(
void)
const;
203 bool listen(
const QString &address,
const quint16 port);
204 quint16 externalPort(
void)
const;
205 quint16 serverPort(
void)
const;
207 void updateConnectionCount(
void);
210 #if QT_VERSION >= 0x050501 && defined(SPOTON_BLUETOOTH_ENABLED) 211 QBluetoothServer *m_bluetoothServer;
212 QBluetoothServiceInfo m_bluetoothServiceInfo;
214 QByteArray m_certificate;
215 QByteArray m_privateApplicationCredentials;
216 QByteArray m_privateKey;
217 QByteArray m_publicKey;
218 QNetworkInterface *m_networkInterface;
222 QString m_orientation;
224 QString m_socketOptions;
225 QString m_sslControlString;
227 QTimer m_externalAddressDiscovererTimer;
232 int m_maximumClients;
234 int m_sourceOfRandomness;
236 qint64 m_maximumBufferSize;
237 qint64 m_maximumContentLength;
238 quint16 m_externalPort;
244 unsigned int m_keySize;
245 QString errorString(
void)
const;
246 int maxPendingConnections(
void)
const;
247 qint64 id(
void)
const;
248 void prepareNetworkInterface(
void);
249 void saveExternalAddress(
const QHostAddress &address,
250 const QSqlDatabase &db);
251 void saveStatus(
const QSqlDatabase &db);
254 void slotDiscoverExternalAddress(
void);
255 void slotExternalAddressDiscovered(
const QHostAddress &address);
256 void slotNeighborDisconnected(
void);
257 #if QT_VERSION < 0x050000 258 void slotNewConnection(
const int socketDescriptor,
259 const QHostAddress &address,
262 void slotNewConnection(
const qintptr socketDescriptor,
263 const QHostAddress &address,
266 #if QT_VERSION >= 0x050501 && defined(SPOTON_BLUETOOTH_ENABLED) 267 void slotNewConnection(
void);
269 void slotTimeout(
void);
272 void newNeighbor(QPointer<spoton_neighbor> neighbor);
Definition: spot-on-sctp-server.h:38
Definition: spot-on-listener.h:91
Definition: spot-on-listener.h:50
Definition: spot-on-listener.h:167
Definition: spot-on-external-address.h:35